﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Domain.Material_Management
{
    /// <summary>
    /// 基础数据-物料管理-Bom
    /// </summary>
    [Table("bominfo")]
    public class BomModel : AuditEntity
    {
        /// <summary>
        /// Bom编码
        /// </summary>
        public string BomCode { get; set; }
        /// <summary>
        /// Bom名称
        /// </summary>
        public string BomName { get; set; }
        /// <summary>
        /// 所属物料群组外键
        /// </summary>
        public long MaterialGroupId { get; set; }
        /// <summary>
        /// Bom版本
        /// </summary>
        public string BomVersion { get; set; }
        /// <summary>
        /// 工序外键
        /// </summary>
        public long ProcessManagementId { get; set; }
        /// <summary>
        /// 用量
        /// </summary>
        public int UseNum { get; set; }
        /// <summary>
        /// Bom描述
        /// </summary>
        public string BomDesc { get; set; }
        /// <summary>
        /// 父级BOM的ID，用于构建树形结构
        /// </summary>
        public long? ParentId { get; set; }
        /// <summary>
        /// BOM层级，根节点为1
        /// </summary>
        public int Level { get; set; } = 1;
        /// <summary>
        /// 是否为叶子节点
        /// </summary>
        public bool IsLeaf { get; set; } = true;
        /// <summary>
        /// 子级BOM列表（导航属性）
        /// </summary>
        public virtual ICollection<BomModel> Children { get; set; } = new List<BomModel>();
        /// <summary>
        /// 父级BOM（导航属性）
        /// </summary>
        public virtual BomModel Parent { get; set; }
    }
}
